package com.ruoyi.weiriya.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseIdEntity;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

import java.util.Date;

/**
 * 配置信息对象 w_setting
 * 
 * @author lynn
 * @date 2023-08-01
 */
@Data
@ApiModel(value = "WSetting", description = "配置信息对象")
public class WSetting extends BaseIdEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    @ApiModelProperty("ID")
    private String id;

    /** 删除标志 true/false 删除/未删除 */
    @Excel(name = "删除标志 true/false 删除/未删除")
    @ApiModelProperty("删除标志 true/false 删除/未删除")
    private Integer deleteFlag;

    /** 配置值value */
    @Excel(name = "配置值value")
    @ApiModelProperty("配置值value")
    private String settingValue;

    /** 创建者 */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建者")
    private String createBy;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty("更新者")
    private String updateBy;

    /** 更新时间 */
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;


    public <T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> wrapper=new QueryWrapper<>();

        wrapper.like(StringUtils.isNotEmpty(id),"id" , id);
        wrapper.like(StringUtils.isNotEmpty(createBy),"create_by" , createBy);
        wrapper.eq(deleteFlag != null,"delete_flag" , deleteFlag);
        wrapper.like(StringUtils.isNotEmpty(updateBy),"update_by" , updateBy);
        wrapper.like(StringUtils.isNotEmpty(settingValue),"setting_value" , settingValue);
        wrapper.orderByDesc("create_time");
        return wrapper;
    }

}
